package d0323;

public class Course2 {
    private String title;
    private double price;

    public Course2(String title, double price) {
        this.title = title;
        this.price = price;
    }
    public boolean equals(Object obj) {
        if(this ==obj){
            return true;
        }
        if(obj ==null){
            return false;
        }
        if(this.getClass()!= obj.getClass()){
            return false;
        }

        Course2 course2 = (Course2) obj;
        if(this.price !=course2.price){
            return false;
        }
        if(title==null){
            if(course2.title !=null){
                return false;
            }
        }else if(!title.equals(course2.title)){
            return false;
        }
        return true;
    }
    public static void main (String[] args){
        Course2 c1 =new Course2("math",100);
        Course2 c2 = new Course2("math",100);
        System.out.println(c1==c2);
        // System.out.println(c1.equals);
    }
}